.div1 {
    width: 500px;        /*设置宽度*/
    border: 5px dotted blue;
    color: lightblue;
    overflow: hidden;        /*隐藏溢出内容*/
    text-overflow:ellipsis;     /*溢出进行省略*/
    white-space: nowrap;         /*强制文本在一行显示*/
}

.div2 {
    width: 200px;
    border: 5px dotted pink;
    color: lightpink;
    overflow: hidden;
    text-overflow:ellipsis;
    white-space: nowrap;

}